/**
 * 
 */
package com.agilegroup.crm.ui.fragments;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;

import com.actionbarsherlock.app.SherlockDialogFragment;
import com.agilegroup.crm.AgileApplication;
import com.agilegroup.crm.R;

/**
 * @author Hisham
 *
 */
public class ConnectionDialogFragment extends SherlockDialogFragment{

	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle(R.string.connection_dialog_title)
        .setMessage(R.string.dialog_connection_text)
               .setPositiveButton(R.string.connection_dialog_btn, new DialogInterface.OnClickListener() {
                   public void onClick(DialogInterface dialog, int id) {
                      getSherlockActivity().finish();
                      if(AgileApplication.getInstance().spiceManager.isStarted()){
                			AgileApplication.getInstance().spiceManager.shouldStop();
                		}
                   }
               });
        setCancelable(false);
        return builder.create();
	}
}
